import numpy as np
from scipy import interpolate

def func(x, y):
    return (x+y)*np.exp(-5.0*(x**2 + y**2))


# 计算曲面上的100个随机分布的点
x = np.random.uniform(-1.0, 1.0, size=100)
y = np.random.uniform(-1.0, 1.0, size=100)
fvals = func(x, y)

# 使用RBF进行插值运算
newfunc = interpolate.Rbf(x, y, fvals, function='multiquadric')
ynew, xnew = np.mgrid[-1:1:100j, -1:1:100j] # 插值结果的网格
fnew = newfunc(xnew, ynew)
truevals = func(xnew, ynew)
